/**
 * Copyright &copy; 2015-2020 <a href="http://www.easyhis.com/">easyhis</a> All rights reserved.
 */
package com.easy.dfcapi.entity;

import com.easy.common.utils.IdGen;
import com.easy.common.utils.excel.annotation.ExcelField;
import com.easy.core.persistence.BaseEntity;
import com.easy.modules.sys.entity.User;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 平台发起的活动表Entity
 * @author waylen chi
 * @version 2018-01-11
 */
public class ApiActivity extends BaseEntity<ApiActivity> {
	
	private static final long serialVersionUID = 1L;
	private Integer activityId;		// ID
	private String id;		// 报名活动UUID
	private Integer cateId;		// 活动类型ID
	private String activityName;		// activity_name
	private String activityDesc;		// activity_desc
	private String activitySubject;		// 活动名称
	private String activityCondition;		// 活动条件
	private String activityImgurl;		// activity_imgurl
	private Date startTime;		// 活动开始时间
	private Date endTime;		// 活动结束时间
	private Date enrollStartTime;		// 活动报名开始时间
	private Date enrollEndTime;		// 活动报名结束时间
	private String showStime;		// 场次开始时间
	private Integer showDtime;		// 场次持续时间，转化为分钟
	private BigDecimal minPrice;		// 活动价格下限
	private BigDecimal maxPrice;		// 活动价格上限
	private Integer totalPsn;		// 活动人数
	private Integer allowPsn;		// 允许可报名人数
	private BigDecimal amnt;		// 报名费
	private BigDecimal deposit;		// 保证金
	private Integer allowCount;		// 活动件数
	private Integer slimit;		// 活动是否对商铺有限制（默认0）
	private Integer plimit;		// 活动是否对商品有限制（默认0）
	private String flag;		// 属性（1-长期活动，2-短期活动）
	private String sortNo;		// 排序
	private Date createTime;		// 创建时间
	private User createBy;		// 创建者
	private Date updateTime;		// 更新时间
	private User updateBy;		// 更新者
	
	public ApiActivity() {
		super();
	}

	public ApiActivity(String id){
		this.id = id;
	}

	@NotNull(message="ID不能为空")
	@ExcelField(title="ID", align=2, sort=0)
	public Integer getActivityId() {
		return activityId;
	}

	public void setActivityId(Integer activityId) {
		this.activityId = activityId;
	}
	
	@ExcelField(title="报名活动UUID", align=2, sort=1)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	@ExcelField(title="活动类型ID", align=2, sort=2)
	public Integer getCateId() {
		return cateId;
	}

	public void setCateId(Integer cateId) {
		this.cateId = cateId;
	}
	
	@ExcelField(title="activity_name", align=2, sort=3)
	public String getActivityName() {
		return activityName;
	}

	public void setActivityName(String activityName) {
		this.activityName = activityName;
	}
	
	@ExcelField(title="activity_desc", align=2, sort=4)
	public String getActivityDesc() {
		return activityDesc;
	}

	public void setActivityDesc(String activityDesc) {
		this.activityDesc = activityDesc;
	}
	
	@ExcelField(title="活动名称", align=2, sort=5)
	public String getActivitySubject() {
		return activitySubject;
	}

	public void setActivitySubject(String activitySubject) {
		this.activitySubject = activitySubject;
	}
	
	@ExcelField(title="活动条件", align=2, sort=6)
	public String getActivityCondition() {
		return activityCondition;
	}

	public void setActivityCondition(String activityCondition) {
		this.activityCondition = activityCondition;
	}
	
	@ExcelField(title="activity_imgurl", align=2, sort=7)
	public String getActivityImgurl() {
		return activityImgurl;
	}

	public void setActivityImgurl(String activityImgurl) {
		this.activityImgurl = activityImgurl;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="活动开始时间", align=2, sort=8)
	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="活动结束时间", align=2, sort=9)
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="活动报名开始时间", align=2, sort=10)
	public Date getEnrollStartTime() {
		return enrollStartTime;
	}

	public void setEnrollStartTime(Date enrollStartTime) {
		this.enrollStartTime = enrollStartTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="活动报名结束时间", align=2, sort=11)
	public Date getEnrollEndTime() {
		return enrollEndTime;
	}

	public void setEnrollEndTime(Date enrollEndTime) {
		this.enrollEndTime = enrollEndTime;
	}
	
	@ExcelField(title="场次开始时间", align=2, sort=12)
	public String getShowStime() {
		return showStime;
	}

	public void setShowStime(String showStime) {
		this.showStime = showStime;
	}
	
	@ExcelField(title="场次持续时间，转化为分钟", align=2, sort=13)
	public Integer getShowDtime() {
		return showDtime;
	}

	public void setShowDtime(Integer showDtime) {
		this.showDtime = showDtime;
	}
	
	@ExcelField(title="活动价格下限", align=2, sort=14)
	public BigDecimal getMinPrice() {
		return minPrice;
	}

	public void setMinPrice(BigDecimal minPrice) {
		this.minPrice = minPrice;
	}
	
	@ExcelField(title="活动价格上限", align=2, sort=15)
	public BigDecimal getMaxPrice() {
		return maxPrice;
	}

	public void setMaxPrice(BigDecimal maxPrice) {
		this.maxPrice = maxPrice;
	}
	
	@ExcelField(title="活动人数", align=2, sort=16)
	public Integer getTotalPsn() {
		return totalPsn;
	}

	public void setTotalPsn(Integer totalPsn) {
		this.totalPsn = totalPsn;
	}
	
	@ExcelField(title="允许可报名人数", align=2, sort=17)
	public Integer getAllowPsn() {
		return allowPsn;
	}

	public void setAllowPsn(Integer allowPsn) {
		this.allowPsn = allowPsn;
	}
	
	@ExcelField(title="报名费", align=2, sort=18)
	public BigDecimal getAmnt() {
		return amnt;
	}

	public void setAmnt(BigDecimal amnt) {
		this.amnt = amnt;
	}
	
	@ExcelField(title="保证金", align=2, sort=19)
	public BigDecimal getDeposit() {
		return deposit;
	}

	public void setDeposit(BigDecimal deposit) {
		this.deposit = deposit;
	}
	
	@ExcelField(title="活动件数", align=2, sort=20)
	public Integer getAllowCount() {
		return allowCount;
	}

	public void setAllowCount(Integer allowCount) {
		this.allowCount = allowCount;
	}
	
	@ExcelField(title="活动是否对商铺有限制（默认0）", align=2, sort=21)
	public Integer getSlimit() {
		return slimit;
	}

	public void setSlimit(Integer slimit) {
		this.slimit = slimit;
	}
	
	@ExcelField(title="活动是否对商品有限制（默认0）", align=2, sort=22)
	public Integer getPlimit() {
		return plimit;
	}

	public void setPlimit(Integer plimit) {
		this.plimit = plimit;
	}
	
	@ExcelField(title="属性（1-长期活动，2-短期活动）", align=2, sort=23)
	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}
	
	@ExcelField(title="排序", align=2, sort=24)
	public String getSortNo() {
		return sortNo;
	}

	public void setSortNo(String sortNo) {
		this.sortNo = sortNo;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="创建时间", align=2, sort=25)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@ExcelField(title="创建者", align=2, sort=26)
	public User getCreateBy() {
		return createBy;
	}

	public void setCreateBy(User createBy) {
		this.createBy = createBy;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="更新时间", align=2, sort=27)
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	@ExcelField(title="更新者", align=2, sort=28)
	public User getUpdateBy() {
		return updateBy;
	}

	public void setUpdateBy(User updateBy) {
		this.updateBy = updateBy;
	}

	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(){
		this.updateTime = new Date();
	}
	/**
	 * 插入之前执行方法，需要手动调用
	 */
	public void preInsert(Date now){
		this.id = IdGen.uuid();

		this.updateTime = now;
		this.createTime = this.updateTime;
	}

	public void preInsert(){
		this.id = IdGen.uuid();
		Date now = new Date();
		this.updateTime = now;
		this.createTime = this.updateTime;
	}
	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(Date now){
		this.updateTime = now;
	}

}